package com.tianyu.inspection.controller;

import com.tianyu.inspection.common.Constants;
import com.tianyu.inspection.common.annotation.Permission;
import com.tianyu.inspection.entity.vo.Ro;
import com.tianyu.inspection.service.api.IStatisticsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**********************************
 * @Author YSW
 * @Description 统计相关接口
 * @Date 2021/2/24 - 10:54
 **********************************/

@RestController
@RequestMapping("/api/2.0/statistics/admin")
public class StatisticsController {

    @Resource
    private IStatisticsService statisticsService;

    @GetMapping(value = "/projectSummary")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> projectSummaryStatistics(){
        return new Ro<>().setContent(statisticsService.projectSummaryStatistics());
    }

    @GetMapping(value = "/user")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> userStatistics(){
        return new Ro<>().setContent(statisticsService.userStatistics());
    }

    @GetMapping(value = "/file")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> fileStatistics(){
        return new Ro<>().setContent(statisticsService.fileStatistics());
    }

    @GetMapping(value = "/pipeline")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> pipelineStatistics(){
        return new Ro<>().setContent(statisticsService.pipelineStatistics());
    }

    @GetMapping(value = "/flyTask")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> flyTaskStatistics(){
        return new Ro<>().setContent(statisticsService.flyTaskStatistics());
    }

    @GetMapping(value = "/danger")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> dangerStatistics(){
        return new Ro<>().setContent(statisticsService.dangerStatistics());
    }

    @GetMapping(value = "/infrastructure")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> infrastructureStatistics(){
        return new Ro<>().setContent(statisticsService.infrastructureStatistics());
    }

    @GetMapping(value = "/infrastructureType")
    @Permission(value = 1,tags = Constants.API_SUPER)
    public Ro<Object> infrastructureTypeStatistics(){
        return new Ro<>().setContent(statisticsService.infrastructureTypeStatistics());
    }
}
